'\" te
.\" Copyright (c) 2004, Sun Microsystems, Inc.
.\" All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH SCTP_PEELOFF 3SOCKET "Mar 05, 2004"
.SH NAME
sctp_peeloff \- branch off existing association from a one-to-many SCTP socket
to create a one-to-one STP socket
.SH SYNOPSIS
.LP
.nf
\fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lsocket\fR \fB -lnsl \fR \fB -lsctp \fR [ \fIlibrary\fR... ]
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/sctp.h>

\fBint\fR \fBsctp_peeloff\fR(\fBint\fR \fIsock\fR, \fBsctp_assoc_t\fR \fIid\fR);
.fi

.SH DESCRIPTION
.LP
The \fBsctp_peeloff()\fR function branches off an existing association from a
one-to-many style SCTP socket into a separate socket file descriptor. The
resulting branched-off socket is a one-to-one style SCTP socket and is confined
to operations allowed on a one-to-one style SCTP socket.
.sp
.LP
The \fIsock\fR argument is a one-to-many socket. The association specified by
the \fIid\fR argument is branched off \fIsock\fR.
.SH RETURN VALUES
.LP
Upon successful completion, the \fBsctp_peeloff()\fR function returns the file
descriptor that references the branched-off socket. The function returns
\fB-1\fR if an error occurs.
.SH ERRORS
.LP
The \fBsctp_peeloff()\fR function fails under the following conditions.
.sp
.ne 2
.na
\fB\fBEOPTNOTSUPP\fR\fR
.ad
.RS 15n
The \fIsock\fR argument is not a one-to-many style SCTP socket.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 15n
The \fIid\fR is \fB0\fR or greater than the maximum number of associations for
\fIsock\fR.
.RE

.sp
.ne 2
.na
\fB\fBEMFILE\fR\fR
.ad
.RS 15n
Failure to create a new user file descriptor or file structure.
.RE

.SH ATTRIBUTES
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Evolving
_
MT-Level	Safe
.TE

.SH SEE ALSO
.LP
.BR in.h (3HEAD),
.BR libsctp (3LIB),
.BR socket (3SOCKET),
.BR sctp (4P)
